package com.taxi.driver.module.amap;

import com.amap.api.services.core.LatLonPoint;
import com.qianxx.utils.RxUtil;
import com.socks.library.KLog;
import com.taxi.driver.common.BasePresenter;
import com.taxi.driver.data.amap.AMapManager;

import javax.inject.Inject;

/**
 * Created by Administrator on 2017/8/22.
 */
public class AMapPresenter extends BasePresenter implements AMapContract.Presenter {

    private final AMapContract.View mView;
    private final AMapManager mAMapManager;

    @Inject
    public AMapPresenter(AMapContract.View view, AMapManager aMapManager) {
        mView = view;
        mAMapManager = aMapManager;
    }

    @Override
    public void subscribe() {
        super.subscribe();
    }

    @Override
    public void unsubscribe() {
        super.unsubscribe();
    }

    @Override
    public void routeSearch(LatLonPoint originPoint, LatLonPoint destPoint) {
        mSubscriptions.add(
                mAMapManager.routeSearch(originPoint, destPoint)
                        .compose(RxUtil.applySchedulers())
                        .subscribe(mView::routeShow,
                                KLog::e));
    }
}
